package com.invalid.android.BtInput;


import android.bluetooth.BluetoothAdapter;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;

public class BluetoothStateChangeReceiver extends BroadcastReceiver {
	/** Tag string for our debug logs */
	private static final String TAG = "BluetoothStateChangeReceiver";
		
	@Override
	public void onReceive(Context context, Intent intent) {
		Bundle extras = intent.getExtras();
		if (extras == null)
			return;
		
		 if (intent.getAction().equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
            
             int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
             
             if (BluetoothAdapter.STATE_ON == state)
             {
            	 Log.d(TAG, "state == on");
/*				Intent i = new Intent();
				i.setClass(context, BluetoothChat.class);
				i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
						| Intent.FLAG_ACTIVITY_SINGLE_TOP);
				context.startActivity(i);*/
             }
             else if (BluetoothAdapter.STATE_OFF == state)
             {
            	 Log.d(TAG, "state == off");
             }
         }
     }
}